#!/bin/bash

# Variables - replace with actual values
FTP_HOST="myfreetemplate.store"
FTP_USER="4503025"
FTP_PASS="AB896ab!2a-e^d3@Ccd+"
WORK_DIR="myfreetemplate.store"
FTP_PORT="21"



# Welcome message
echo "Welcome......"

# Prompt for the file name
read -p "Enter File: " FILENAME

# Check if the input is empty
if [ -z "$FILENAME" ]; then
    echo "Bad Input......"
    exit 1
fi

# Use FTP in interactive mode and send commands step-by-step
ftp -inv $FTP_HOST <<EOF
user $FTP_USER $FTP_PASS
pass
cd $WORK_DIR
binary
get $FILENAME
quit
EOF

# Check if the download was successful
if [ $? -eq 0 ]; then
    echo "Success, Exiting......"
else
    echo "Error: Failed to download file, Exiting......"
fi
